#include <iostream>
#include <vector>
using namespace std;

int main() {
    string a;
    cin >> a;
    bool flag = true;
    vector<char> b;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == '(' or a[i] == '[' or a[i] == '{' or a[i] == '<') {
            b.push_back(a[i]);
        }
        else if (a[i] == ')' or a[i] == ']' or a[i] == '}' or a[i] == '>') {
            if (b.empty()) {
                flag = false;
                break;
            }
            else if (a[i] - b.back() == 1 or a[i] - b.back() == 2) {
                b.pop_back();
            }
            else {
                flag = false;
                break;
            }
        }
    }

    if (flag and b.empty()) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}
